#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
/*int main() {
    int n = 0;
    int m = 0;
    scanf("%d %d", &n, &m);
    int arr1[5];
    int arr2[6];
    int i = 0;
    for (i = 0; i < n; i++) {
        scanf("%d", &arr1[i]);
    }
    for (i = 0; i < m; i++) {
        scanf("%d", &arr2[i]);
    }
    int arr3[11];
    i = 0;
    int j = 0;
    int k = 0;
    while (i < n && j < m) {
        if (arr1[i] < arr2[j]) {
            arr3[k++] = arr1[i++];

        }
        else {
            arr3[k++] = arr2[j++];

        }
    }
    if (i == n) {
        while (j < m) {
            arr3[k] = arr2[j];
            k++;
            j++;
        }
    }
    else {
        while (i < n) {
            arr3[k] = arr1[i];
            i++;
            k++;
        }
    }
    i = 0;
    for (i = 0; i < m + n; i++) {
        printf("%d ", arr3[i]);
    }
}*/
/*int main() {
    int year = 0;
    int month = 0;
    while ((scanf("%d %d", &year, &month) == 2)) {
        if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
            switch (month) {

            case 2:
                printf("29");
                break;
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                printf("31");
                break;
            default: printf("30\n"); break;


            }
        }
        else
            switch (month) {

            case 2:
                printf("28");
                break;
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                printf("31");
                break;
            default: printf("30\n"); break;

            }
    }
}*/
#include<stdio.h>
int main()
{
    int i, j;
    for (i = 10000; i < 99999; i++)
    {
        int sum = 0;
        for (j = 10; j <= 10000; j = 10 * j)
        {
            sum += (i / j) * (i % j);
        }
        if (sum == i)
            printf("%d ", i);
    }
    return 0;
}